<template name='person_admin'>
	<view>
		<view style="width: 100%;height: 90%;display: flex;justify-content: center;align-items: center;">
			<view style="width: 96%;position: absolute; top:0; background-color: #FFFFFF;box-shadow: 1px 1px 5px #C0C0C0;padding-top: 20upx;">
				
				<!-- 数据列表 -->
				<view style="color: #606270;display: flex;width: 100%;justify-content: center;font-size: 15px;flex-direction: column;align-items: center;">
					<view style="border-bottom: 1px solid #EBEEF5;display: flex;flex-direction: row;width: 90%;background-color: #F5F7FA;padding: 10upx;">
						
						<view style="width: 15%;">
							账号
						</view>
						<view style="width: 10%;">
							资产
						</view>
						<view style="width: 10%;">
							是否通过认证
						</view>
						<view style="width: 40%;">
							认证信息（认证信息全部在这里）
						</view>
						<view style="width: 20%;">
							user_id
						</view>
						<view style="width: 20%;">
							创建时间
						</view>
						<view style="width: 20%;">
							操作
						</view>
					</view>
					<checkbox-group @change="checkbox_change" style="width: 90%;display: flex;flex-direction: column;justify-content: center;align-items: center;">
					<view v-for="(item,index) in PersonList" :key=index class="list_detail" style="">
						<!-- <checkbox :value="item.user_id.toString()" :checked='checkbox' style="transform:scale(0.7);width: 5%;"/> -->
						<view style="width: 15%;">
							{{item.mobile}} 
						</view>
						<view style="width: 10%;">
							{{item.money || 0}} 
						</view>
						<view style="width: 10%;">
							{{ item.is_valid === 2 ? '未认证' : '已认证' }}
						</view>
						<view style="width: 40%;">
							{{item.valid_infos}}
						</view>
						<view style="width: 20%;">
							{{item.user_id}}
						</view>
						<view style="width: 20%;">
							{{item.create_time}}
						</view>
						<view style="width: 20%;display: flex;flex-direction: row;">
							<view v-if="item.is_valid==2" @click="alter(item)" class="alter" style="">
								审核
							</view>
							<view v-if="item.is_valid==1"  class="alter" style=" color: brown;">
								已通过审核
							</view>
						</view>
					</view>
					</checkbox-group>
					
				</view>
				<!-- 数据列表end -->
			</view>
		</view>
		<!-- 编辑遮罩层 -->
		<uni-popup ref="popup" type="center">
		    <view style="width: 500upx;display: flex;background-color: #FFFFFF;flex-direction: column;box-shadow: 1px 1px 1px #808080;border-radius: 2upx;">
		        <view style="border-bottom: 1px solid #DCDFE6;font-size: 18px;display: flex;flex-direction: row;padding: 20upx;width: 460upx;align-items: center;">
					<view>
						创建者审核
					</view>
					<image class='alter_sure' @tap="close" src="../../static/close.png" style="margin-left: auto;height: 15upx;width: 15upx;padding: 5upx;"></image>
				</view>
		        <view style="border-bottom: 1px solid #DCDFE6;color: #606266;font-size: 15px;width: 440upx;padding: 30upx;display: flex;flex-direction: column;justify-content: center;align-items: center;">
					
					<view style="width: 360upx;padding: 15upx;display: flex;flex-direction: row;align-items: center;">
						<view style="color: red;">
							*已完成资料审核并同意该账号在系统中创建众筹项目*
						</view>
						
					</view>
					
				</view>
				<view style="width: 100%;display: flex;align-items: center;font-size: 12px;color: #FFFFFF;">
					<view style="width: 60%;display: flex;flex-direction: row;align-items: center;padding: 15upx;">
						<view @click="alter_cancel" style="margin-left: auto;padding: 8upx 15upx 8upx 15upx;color: #606266;border: 1px solid #DCDFE6;">
							取 消
						</view>
						<view @click="alter_sure" style="margin-left: 18upx;padding: 8upx 15upx 8upx 15upx;background-color:#1890FF">
							确 定
						</view>
					</view>
				</view>
		    </view>     
		</uni-popup>
		<!-- end -->
	</view>
	
</template>

<script>
	import uniPopup from "@/components/uni-popup/uni-popup.vue"
	import global from "@/common/global.js"
	export default{
		name:'admin_person',
		components: {
			uniPopup
		},
		data(){
			return{
				c_id: '',
				c_name:'',
				c_info: '',
				c_user_id: '',
				name:'认证审核',
				
			}
		},
		 // 此处定义传入的数据
		props: {
		    PersonList: {
		        type: Array,
		        value: []
		    },
		},
		onShow() {
			console.log('show')
			// this.getUser()
			// console.log(123)
		},
		onLoad() {
			console.log('load')
		},
		methods:{
			alter_cancel(){
				this.$refs.popup.close()
			},
			alter_sure(){
				var that = this
				console.log(that.c_user_id)
				// 手机号正则
				uni.showModal({
					title:'请再次检查！',
					content: '用户ID: '+ this.c_id +'\n' + '用户名: '+ this.c_name +'\n' + '用户信息: ' + this.c_info,
					confirmText: '确认通过',
					cancelText: '取消操作',
					success: function (res) {
							if (res.confirm) {
								uni.request({
									url:global.baseUrl+'api/user/user_admin_auth',
									method: "POST",
									data:{
										user_id: that.c_user_id,
										
										
									},					
									success: function (res) {
										console.log(res)
											if(res.data.code == 10000){
												uni.showToast({
													icon: 'none',
													title:'审核成功',
													duration: 2000
												})
												
												  setTimeout(() => {
												    uni.navigateTo({
												        url: '/pages/admin/admin'
												      });
												  }, 1000);
											}else{
												uni.showToast({
													icon: 'none',
													title:'审核失败',
													duration: 2000
												})
											}
										}
									})
							} else if (res.cancel) {
								console.log('用户点击取消');
								
							}
							that.$refs.popup.close()
						}
				})
				
								

			},
			close(){
				this.$refs.popup.close()
			},
			alter:function(item){
				this.$refs.popup.open()
				console.log(item)
				this.c_id = item.mobile
				this.c_user_id = item.user_id
				this.c_name = item.username
				this.c_info = JSON.stringify(item.valid_infos)
			},
			
			
		}
	}
</script>

<style>
	.alter_sure:hover{
		border: 1upx solid #C8C7CC;
	}
	.alter_sure{
		margin-left: auto;height: 15upx;width: 15upx;padding: 5upx;
		border: 1px solid #FFFFFF;}
	.add_color{
		background-color: #1890FF;
		
	}
	.add_color:hover{
		background-color: #46A6FF;
	}
	.admin_pic{
		width: 180upx;
		height: 50upx;
		padding: 20upx;
	}
	.admin_pic:hover{
		background-color: #2C405A;
	}
	.arrow{
		height: 20upx;
		width: 20upx;
		
		margin-left: auto;
	}
	.arrow1{
		height: 18upx;
		width: 18upx;
		
	}
	.detail{
		padding: 20upx 20upx 20upx 40upx;
		width: 160upx;
		display: flex;
		flex-direction: row;
		color: #FFFFFF;
		font-size: 15px;
		align-items: center;
		
	}
	.detail:hover{
		background-color: #1890FF;
	}
	.list_detail{
		border-bottom: 1px solid #EBEEF5;display: flex;flex-direction: row;width: 100%;padding: 10upx;
	}
	.list_detail:hover{
		background-color: #F5F7FA;
	}
	.alter{
		color: #1890FF;
	}
	.alter:hover{
		text-decoration: underline;
		color: #DD524D;
	}
	.delete{
		color: #1890FF;margin-left: 10upx;
	}
	.delete:hover{
		text-decoration: underline;
		color: #DD524D;
	}
	.left{
		background-color: #F4F4F5;
		width: 15upx;
		height: 15upx;
		padding: 10upx;
	}
	.page{
		color: #FFFFFF;
		background-color: #1890FF;
		width: 32upx;
		height: 32upx;
		font-size: 15px;
		border-radius: 3upx;
		text-align: center;
		justify-content: center;
		display: flex;
		align-items: center;
		margin-left: 10upx;
	}
	.nopage{
		color: #FFFFFF;
		background-color: #F4F4F5;
		width: 32upx;
		height: 32upx;
		font-size: 15px;
		border-radius: 3upx;
		text-align: center;
		justify-content: center;
		display: flex;
		align-items: center;
		margin-left: 10upx;
		color: #606270;
	}
	.right{
		margin-left: 10upx;
		background-color: #F4F4F5;
		width: 15upx;
		height: 15upx;
		padding: 10upx;
	}
	.input_account{
		padding: 5upx 15upx 5upx 15upx;border: 1px solid #DCDFE6;width: 250upx;font-size: 13px;margin-left: 20upx;
	}
	.input_account:hover{
		border: 1px solid #C8C7CC;
	}
	.input_account1{
		padding: 5upx 15upx 5upx 15upx;border: 1px solid #DCDFE6;width: 227upx;font-size: 13px;margin-left: 20upx;
	}
	.input_confirm{
		border: 1px solid #1890FF;
		padding: 5upx 15upx 5upx 15upx;width: 250upx;font-size: 13px;margin-left: 20upx;
	}
	.back_color{
		background-color: #FF4D4F;
	}
	.back_color:hover{
		background-color: #FF7172;
	}
</style>
